//
// Created by liaojili on 2023/11/11.
//

#include <stdio.h>
# define ROWS 2
# define COLS 3
void main(){
    // 将一个二位数组行和列的元素互换，存到另一个二位数组中
    int arr[ROWS][COLS] = {
            {1, 2, 3},
            {4, 5, 6}
    };
    int newArr[COLS][ROWS];
    for (int i = 0; i < ROWS; ++i){  // 0
        for (int j = 0; j < COLS; ++j) {// 0,1, 2
            newArr[j][i] = arr[i][j];
            printf("%d", arr[i][j]);
        }
        printf("\n");
    }

    for (int i = 0; i < COLS; ++i){
        for (int j = 0; j < ROWS; ++j) {
            printf("%d", newArr[i][j]);
        }
        printf("\n");
    }
}